package com.outstanding.junit.dto.voice;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.outstanding.framework.core.MultiPendingException;
import com.outstanding.framework.core.RequestDTO;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@SuppressWarnings("rawtypes")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class VoiceReqDto extends RequestDTO {

	/** serialVersionUID */
	private static final long serialVersionUID = -5703938849350099614L;

	/** 验证码 */
	private String code;

	/** 手机号码 */
	private String mobile;

	@Override
	public boolean validate() throws MultiPendingException {

		if (StringUtils.isEmpty(code) || !code.matches("^[0-9]{6}$")) {
			return false;
		}

		if (StringUtils.isEmpty(mobile)) {
			return false;
		}

		return true;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}
}
